package product.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import product.domain.AttrAttrgroupRelation;
import product.mapper.AttrAttrgroupRelationMapper;
import product.service.AttrAttrgroupRelationService;
import org.springframework.stereotype.Service;
import product.vo.AttrRelationVo;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author panghu
 * @description 针对表【pms_attr_attrgroup_relation(属性&属性分组关联)】的数据库操作Service实现
 * @createDate 2023-03-04 21:03:08
 */
@Service
public class AttrAttrgroupRelationServiceImpl extends ServiceImpl<AttrAttrgroupRelationMapper, AttrAttrgroupRelation>
        implements AttrAttrgroupRelationService {

    @Override
    public void saveBatchRelation(List<AttrRelationVo> attrRelationVoList) {
        List<AttrAttrgroupRelation> relationList = attrRelationVoList.stream().map(attrRelationVo -> {
            AttrAttrgroupRelation relation = new AttrAttrgroupRelation();
            BeanUtils.copyProperties(attrRelationVo, relation);
            return relation;
        }).collect(Collectors.toList());
        this.saveBatch(relationList);
    }
}




